package com.java01;

import java.util.Scanner;

public class fourthjava {
    public static void main(String[] args) {
        //定义scanner对象
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入年龄：");
        //把输入的年龄保存到age
        int age = scanner.nextInt();
        if (age > 18){
            System.out.println("你年龄大于18岁，要对自己的行为负责。");
        }else {
            System.out.println("你还没成年，这不怪你。");
        }
    }
}
class years{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int i = 1;

        for (;;){
            System.out.println("请输入一个年份：");
            int year = scanner.nextInt();
            if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
                System.out.println(year + "是闰年。");
                break;
            } else {
                System.out.println(year + "不是闰年。");
                System.out.println("程序继续");
            }
        }
    }
}

class race{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入初赛成绩：");
        double score = scanner.nextDouble();
//        System.out.println("请输入");
//        char gender = scanner.next().charAt(0);
        if (score >= 8.0){
            System.out.println("恭喜您，成功晋级");
            System.out.println("请输入性别：");
            char gender = scanner.next().charAt(0);
                if (gender == '男') {
                    System.out.println("您进入的是男子组。");
                } else if (gender == '女'){
                    System.out.println("您进入的是女子组。");
                }else {
                    System.out.println("请输入正确的性别！");
                }
        }else {
            System.out.println("很遗憾，被淘汰了。");
        }

    }
}

class travle{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入月份：");
        int month = scanner.nextInt();
        if (month >= 4 && month <= 10){
            System.out.println("现在是旺季");
            System.out.println("请输入购票人年龄：");
            int age = scanner.nextInt();
            if (age >= 18 && age <= 60){
                System.out.println("当前购票人为成年人，票价为60元/人。");
            }else if (age >= 0 && age < 18){
                System.out.println("当前购票人为儿童，票价为30元/人。");
            }else {
                System.out.println("当前购票人为老人，票价为20元/人。");
            }
        }else if (month > 0 && month < 4 || month > 10 && month <= 12){
            System.out.println("现在是淡季");
            System.out.println("请输入购票人年龄：");
            int age = scanner.nextInt();
            if (age >= 18 && age <= 60){
                System.out.println("当前购票人为成年人，票价为40元/人。");
            }else {
                System.out.println("当前购票人非成年人，票价为20元/人。");
            }
        }
    }
}